﻿@model IEnumerable<Model.CreditSetup>

<div class="well well-sm">挂账销售设置:&nbsp;<button type="button" class="btn btn-danger btn-sm" onclick="Opn_myModal_AddCreditSetup()">增加挂账项目</button></div>
<div class="table-responsive">
    <table class="table table-hover table-condensed">
        @{


            foreach (var C in Model)
            {
                <tr>

                    <td>@C.CreditName</td>
                    <td><button class="btn btn-default btn-sm" type="submit" onclick="Modify_CreditSetup('@C.CreditID','@C.CreditName')">修改</button></td>
                    <td><button class="btn btn-default btn-sm" type="submit" onclick="Delete_CreditSetup('@C.CreditID')">删除</button></td>
                </tr>
            }}
    </table>
</div>

@Html.Partial("Modal_AddCreditSetup")
@Html.Partial("Modal_ModifyCreditSetup")
<script type="text/javascript">
    function Opn_myModal_AddCreditSetup() {
        $('#myModal_AddCreditSetup').modal('show')

    }
    function Modify_CreditSetup(CreditID, CreditName) {
        //Modify_CostClassID
        $("#myModal_ModifyCreditSetup .modal-header span:last-child").html(CreditName);
        $("#myModal_ModifyCreditSetup .modal-header input").val(CreditID);
        $("#myModal_ModifyCreditSetup").modal("show");
    }
</script>
<script type="text/javascript">

    function Delete_CreditSetup(CreditID)
    {
        $.ajax({
            type: 'POST',
            data: "CreditSetupID=" + CreditID,


            url: 'Admin/Btn_DeleteCreditSetup',
            success: function (data) {

                if (data == "ok") {
                    //$("#myModal_AddGords").modal("hide");
                    //刷新下拉菜单绑定的商品分类

                    //增加添加成功信息

                    //刷新下拉菜单绑定的商品分类
                    $("#Pannel_ManageList").load("Admin/CreditSetup_List");



                }
                else { alert("没有成功"); }

            },
            error: function (error) {
                alert(error.responseText);
            }
        });
    }
</script>